import java.util.Random;
import java.util.Scanner;

public class test15 {
    public static void main(String[] args) {
        Random random = new Random();
        int ranNum = random.nextInt(100);//生成[1，100）
        System.out.println(ranNum);
        Scanner scanner = new Scanner(System.in);
        while(true){
            System.out.println("请输入你要猜的数字");
            int num = scanner.nextInt();
            if (num < ranNum){
                System.out.println("小了");
            }else if(num == ranNum){
                System.out.println("猜对了");
                break;
            }
            else{
                System.out.println("大了");
            }
        }
    }
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个字符串：");
        String str = scanner.next();//或String str = scanner.nextLine();
        System.out.println(str);
        System.out.println("读入一个整形：");
        int age = scanner.nextInt();
        System.out.println(age);
        System.out.println("读入一个小鼠：");
        float f = scanner.nextFloat();
        System.out.println(f);
    }
    }

